package frmsystem.gui;

import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.SpringLayout;

public class ReportUI extends JDialog {
	
	private JTextArea textArea;
	private JScrollPane scroll;
	private SpringLayout layout;
	private JButton cmdCancel;
	public ReportUI(String text){
		layout = new SpringLayout();
		getContentPane().setLayout(layout);
		
		textArea = new JTextArea(30, 60);
		textArea.setText(text);
		textArea.setEditable(false);
		scroll = new JScrollPane(textArea);
		getContentPane().add(scroll);
		layout.putConstraint(SpringLayout.WEST, scroll, 10, SpringLayout.WEST, getContentPane());
		layout.putConstraint(SpringLayout.NORTH, scroll, 10, SpringLayout.NORTH, getContentPane());
		
		cmdCancel = new JButton("Close");
		getContentPane().add(cmdCancel);
		layout.putConstraint(SpringLayout.WEST, cmdCancel, 300, SpringLayout.WEST, getContentPane());
		layout.putConstraint(SpringLayout.NORTH, cmdCancel, 20, SpringLayout.SOUTH, scroll);
		
		setSize(700, 600);
		setModal(true);
		
	}
	
	public void addCloseActionListener(ActionListener al){
		cmdCancel.addActionListener(al);
	}
}
